using UnityEngine;
using System.Collections;

public class SoundManager : MonoBehaviour {

    private static SoundManager _instance;

    public static SoundManager Instance
    {
        get { return SoundManager._instance; }
    }


    public AudioClip[] clips;


	// Use this for initialization
	void Awake () {
        _instance = this;
	}
	
	// Update is called once per frame
	void Update () {
	
	}

    public void PlayFX(string name)
    {
        this.audio.PlayOneShot(GetSound(name));        
    }

    private AudioClip GetSound(string name)
    {
        foreach (AudioClip c in clips)
        {
            if(c != null)
            {

                if (c.name == name)
                    return c;
            
            }
            
        }
        return null;
    }
}
